﻿/*include:js\declare*/
//键盘事件	<input inputkeycode="{Keys:{13:alert}}" id="XXX" />
(function(){
var InputKeyCode=function()
	{
	this.GetArgument(arguments[0],{Id:null,Event:null,Keys:{},OnAnyKey:null});
	this.Start(this.Event||{IsGetOnly:1});
	};
(fastCSharp.Functions.InputKeyCode=InputKeyCode).Inherit(fastCSharp.BaseFunction,{
Start:function(Event)
	{
	if(!Event.IsGetOnly)
		{
		var Element=fastCSharp.$Id(this.Id),Input=Element.Element();
		if(Input!=this.Element)
			{
			this.Element=Input;
			Element.AddEvent('keyup,keypress',fastCSharp.ThisEvent(this,this.OnKey));
			}
		}
	},
OnKey:function(Event)
	{
	var Value=this.Keys[Event.keyCode];
	if(Value)	Value();
	if(this.OnAnyKey)	this.OnAnyKey();
	}
		});
new fastCSharp.Declare('InputKeyCode','focus','Src');
})();